package com.yige.service;

import com.mongodb.DBObject;

import java.util.List;

/**
 * Created by sunhao on 2015/9/22 0022.
 */
public interface UserService extends BasicMongoService {

    /**根据用户名查找用户*/
    DBObject findUserByName(String username);

    /**根据用户id修改密码*/
    boolean updatePwd(DBObject user, String lastPwd, String newPwd);

    /**查找用户拥有角色*/
    List<DBObject> findAllRoleByUser(Object userId);

    /**给用户绑定角色*/
    boolean bindRoleForUser(Object userId, Object roleId);

    /**给用户解除角色*/
    boolean removeRoleForUser(Object userId, Object roleId);

    /**修改用户角色*/
    boolean updateRoleForUser(Object userId, List<DBObject> roles);

    /**用户拥有权限*/
    List<String> findUserAuth(DBObject user);

}
